#pragma once
#include <QAbstractItemModel>
#include <vector>

#include "ProjectPlan/PPPreTask.h"
#include "ProjectPlan/PPTask.h"

namespace LBPROJLOGIC
{
    class CPreTaskTableModel : public QAbstractItemModel
    {
    public:
        CPreTaskTableModel(QObject *parent = Q_NULLPTR);
        ~CPreTaskTableModel();

        void SetPreTaskList(std::vector<SEditPreTaskItem>* pList);
        void SetTaskGroup(const LBPROJ::ITaskGroup* pGroup);

        virtual QVariant data(const QModelIndex &index, int role) const override;
        virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;

        virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;

        virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
        virtual QModelIndex parent(const QModelIndex &index) const override;

        virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
        virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;

        virtual bool removeRows(int position, int rows, const QModelIndex &parent = QModelIndex()) override;
        virtual bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex()) override;

        virtual Qt::ItemFlags flags(const QModelIndex &index) const override;

    protected:
        std::vector<SEditPreTaskItem>* m_pPreTaskList;
        const LBPROJ::ITaskGroup* m_pGroup;

    };

}

